@extends('admin.layouts.app')

@section('right-content')
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>编辑商品</legend>
    </fieldset>

    <form class="layui-form" action="" style="margin-right: 60%">
        <div class="layui-form-item">
            <label class="layui-form-label">商品名称</label>
            <div class="layui-input-block">
                <input type="text" name="item_name" value="{{ $goods->item_name }}" lay-verify="required" autocomplete="off" placeholder="请输入商品名称" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">商品编号</label>
            <div class="layui-input-inline">
                <input type="text" name="product_no" value="{{ $goods->product_no }}" lay-verify="required|number" autocomplete="off" placeholder="请输入商品编号" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">需要和爱贝支付后台商品编号对应</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">充值金额</label>
            <div class="layui-input-inline">
                <input type="text" name="price" value="{{ $goods->price }}" lay-verify="required|number" placeholder="请输入充值金额" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">获得筹码</label>
            <div class="layui-input-inline">
                <input type="text" name="gold" value="{{ $goods->gold }}" lay-verify="required|number" placeholder="请输入获得筹码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">赠送筹码</label>
            <div class="layui-input-inline">
                <input type="text" name="gift_gold" value="{{ $goods->gift_gold }}" lay-verify="number" placeholder="请输入赠送筹码" autocomplete="off" class="layui-input">
            </div>
        </div>

        {{-- <div class="layui-form-item">
            <label class="layui-form-label">vip经验</label>
            <div class="layui-input-inline">
                <input type="text" name="vip_score" value="{{ $goods->vip_score }}" lay-verify="number" placeholder="请输入vip经验值" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">赠送经验</label>
            <div class="layui-input-inline">
                <input type="text" name="gift_vip_score" value="{{ $goods->gift_vip_score }}" lay-verify="number" placeholder="请输入赠送vip经验值" autocomplete="off" class="layui-input">
            </div>
        </div> --}}

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">商品描述</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" class="layui-textarea" name="note">{{ $goods->note }}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input type="text" name="order_id" value="{{ $goods->order_id }}" lay-verify="" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">支付方式</label>
            <div class="layui-input-block">
                <input type="radio" name="pay_way" value="1" title="Android" @if ($goods->pay_way == 1) checked @endif>
                <input type="radio" name="pay_way" value="2" title="IOS" @if ($goods->pay_way == 2) checked @endif>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="enable" value="1" title="上线" @if ($goods->enable == 1) checked @endif>
                <input type="radio" name="enable" value="0" title="下线" @if ($goods->enable == 0) checked @endif>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="sub" data-url="{{ route('goods.update', ['id' => $goods->id]) }}">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
@endsection

@section('my-js')
<script type="text/javascript">
   layui.use('form', function(){
       var form = layui.form;

      form.on('submit(sub)', function(data){
        var url = $(this).attr('data-url');
        commonAjaxSubmit(url, 'PUT');

      })
    });
</script>
@endsection